library(tidyverse)
library(wbstats)
library(plotly)

1 Gross Domestic Product (GDP)

We can initially approach the concept of GDP by explaining the terms “Product”, “Domestic” and “Gross” separately (Lequiller and Blades 2014, Chapter 1):

1.1 Three equivalent ways to measure the GDP

Initially the units in which GDP is measure is in monetary units of a specific currency, \(c\). Therefore \(GDP_{s}^{c}(t)\) means the \(GDP\) of territory \(s\) in a given period \(t\). To make the discussion less abstract we present a plot of \(GDP\) for Colombia, \(s = COL\), expressed in Colombian pesos, \(c = COP\), for the years 1960 to 2019, \(t = 1960, \ldots, 2019\):

# Clean data
gdp_colombia <- wbstats::wb(country   = "COL", 
                             indicator = "NY.GDP.MKTP.CN", 
                             startdate = 1960, 
                             enddate   = 2019) %>% 
    tibble::as_tibble() %>% 
    dplyr::select(date, value) %>%
    dplyr::mutate(date       = as.double(date),
                  label_text = stringr::str_glue('Year: {date}
                                                  GDP: {value %>% scales::dollar()}')) 

# Plot
    
static_plot <- gdp_colombia %>%
    # Data
    ggplot2::ggplot(aes(x = date, y =value)) +
    # Geoms
    ggplot2::geom_point(aes(text = label_text),
                        shape = 21, 
                        color = "black", 
                        fill  = "red") + 
    ggplot2::geom_line(linetype = "dashed") +
    # Scales
    scale_x_continuous(breaks = c(1960:2019)) +
    scale_y_continuous(breaks = seq(from = 0, to = 1.10e15, by = 1e14), 
                       labels = scales::number_format(scale = 1/1e12, suffix = "B")) +
    labs(x = "Year",
         y = "GDP in current local currency [B = Billion in long scale (10^12)]",
         title = "GDP of Colombia: 1960-2019") +
    # Themes
    theme(panel.border      = element_rect(fill = NA, color = "black"),
          plot.background   = element_rect(fill = "#f3fcfc"),          
          panel.background  = element_rect(fill = "#f3f7fc"),
          legend.background = element_rect(fill = "#f3fcfc"), 
          plot.title        = element_text(face = "bold"),
          axis.text.x=element_text(angle = -90, vjust = 0.5),
          axis.title        = element_text(face = "bold"),
          legend.title      = element_text(face = "bold"),
          axis.text         = element_text(face = "bold"))

    # Interactivity
    static_plot %>% 
      plotly::ggplotly(tooltip = "text")

Bibliography

Lequiller, François, and Derek Blades. 2014. Understanding National Accounts: Second Edition. OECD. https://doi.org/10.1787/9789264214637-en.